package demo1;


import java.util.Arrays;

public class Solution {
    public void rotate(int[] nums, int k) {
        for (int i = 0; i < k; i++) {

            int tmp =  nums[nums.length -1];

            for (int j = nums.length -1; j > 0; j--) {

                nums[j] = nums[j - 1];
            }
            nums[0] = tmp;

        }
    }
    public static void main(String[] args) {
        Solution solution  = new Solution();
        int[] nums = new int[]{1,2,3,4,5};
        solution.rotate(nums,2);
        System.out.println(Arrays.toString(nums));
    }
}
